package com.hong.decorator;

import com.hong.aop.Greeting;

/**
 * 具体装饰器,实现类似AOP中的前置增强效果
 */
public class BeforeGreetingDecorator extends AbstractGreetingDecorator {

    public BeforeGreetingDecorator(Greeting greeting) {
        super(greeting);
    }

    @Override
    public void sayHello(String name) {
        before();
        super.sayHello(name);
    }

    private void before(){
        System.out.println("before");
    }
}
